home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / test / lib / piperdr.c < prev    next >
C/C++ Source or Header  |  1992-11-23  |  342b  |  26 lines

  1.  
  2. #include <sys/types.h>
  3.  
  4. fd_set    fdr;
  5.  
  6. main()
  7. {
  8.     int n;
  9.     char buf[256];
  10.  
  11.     puts("READY");
  12.  
  13.     for (;;) {
  14.     FD_SET(0, &fdr);
  15.     n = select(1, &fdr, NULL, NULL, NULL);
  16.     printf("RESULT %d\n", n);
  17.     n = read(0, buf, sizeof(buf));
  18.     if (n <= 0)
  19.         break;
  20.     printf("TEXT: (%d) %*.*s\n", n, n, n, buf);
  21.     }
  22.     puts("DONE");
  23.     return(0);
  24. }
  25.  
  26.